<template>
  <div class="form_item-list">
    <list :data="value" :cols="clos"></list>
  </div>
</template>

<script>
import {list_cols} from "@/js/tool.js";

export default {
  _title_: '列表数据',
  _can_form_param_: true,
  name: "list_data",
  props: ['name', 'value', 'config', 'is_info', 'more', 'no_table', 'size', 'is_list'],
  emits: ['update:value', 'change'],
  data(){
    return {
      need_display: true,
      this_value: this.value,
      clos: [],
    }
  },
  methods: {
    display(){
      let config = this.config;
      if (typeof config === 'string'){
        try {
          config = JSON.parse(config);
        } catch (e) { }
        if (typeof config !== 'object') config = list_cols(config);
      }
      this.clos = config;
    },
  },
  watch: {
    config(v, oldV){
      if (!this.need_display) return;
      this.display();
    },
  },
  computed: {
  },
  mounted() {
    this.display();
  }
}
</script>

<style scoped>

</style>